<!-- 角色列表 -->
<extend name="Public:layout" />
<block name="title"><{$authName}></block>

<block name="pluginCSS">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/plugins/select2/select2.css"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/plugins/select2/select2-metronic.css"/>
<link rel="stylesheet" href="__PUBLIC__/Admin/plugins/data-tables/DT_bootstrap.css"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/plugins/bootstrap-fileinput/bootstrap-fileinput.css"/>
</block>
<block name="CSS"></block>

<block name="loadJS">
<script src="__PUBLIC__/Admin/plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/plugins/select2/select2.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/plugins/data-tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/plugins/data-tables/fnReloadAjax.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/plugins/data-tables/DT_bootstrap.js"></script>
<script src="__PUBLIC__/admin/scripts/layer/layer.js" type="text/javascript"></script>	
<script src="__PUBLIC__/admin/plugins/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script>
</block>
<block name="setJS">
<script src="__PUBLIC__/Admin/scripts/custom/tableRole.js"></script>
<script src="__PUBLIC__/Admin/scripts/custom/validateRole.js"></script>
<script>
var ajaxUrl="<{:U('index')}>";
</script>
</block>
<block name="initJS">
TableRole.init();
ValidateRole.init();
</block>

<block name="pagetitle">角色的增删改查</block>
<block name="page">

<div class="row">
	<div class="col-md-12">

		<div class="portlet">
			<div class="portlet-title">
				<div class="caption">
					<i class="fa <{$authIco}>"></i><{$authName}>
				</div>
				
				<div class="actions">
					
					<a class="btn default green-stripe" data-toggle="modal" href="#" id="table_role_new">
						<i class="fa fa-plus"></i>
						<span class="hidden-480">添加角色</span>
					</a>
				</div>
				
			</div>
			<div class="portlet-body">
				<table class="table table-striped table-hover table-bordered" id="table_role">
				</table>
			</div>
		</div>
	</div>
</div>

<div id="responsive" class="modal fade bs-modal-lg" tabindex="-1" aria-hidden="true">
	<div class="modal-dialog modal-lg">
		<form class="role-form" action="<{:U('index')}>" method="post">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
				<h4 class="modal-title"></h4>
			</div>
			<div class="modal-body">
				<div class="scroller" style="height:420px" data-always-visible="1" data-rail-visible1="1">
					<div class="row">
						<input type="hidden" name="ajax" value="">
						<input type="hidden" name="roleId" value="">
						<div class="form-body form-horizontal">
							<div class="col-md-12">
								<div class="form-group">
									
									<label class="control-label col-md-2"><strong>
									角色名称</strong></label>
									
									<div class="col-md-4">
										<div class="input-icon">
											<i class="fa fa-users"></i>
											<input type="text" class="form-control" placeholder="角色名称" name="roleName" id="roleName">
										</div>
									</div>
								</div>
								<div class="form-group">
									<label class="col-md-2 control-label"><strong>角色权限</strong></label>
									<div class="col-md-10">
										<p class="form-control-static">
											 请勾选相应板块为角色分配权限。
										</p>
									</div>
								</div>
								
								<foreach name="auths" item="val" key="key">
								<php>
									if(substr_count($val['authPath'],',')==1):
								</php>
								<div class="form-group">
									<label class="col-md-2 control-label"><i class="fa <{$val['authIco']|default='fa-cog'}>"></i> <{$val['authName']}></label>
									<div class="col-md-10">
										<div class="checkbox-list">
										<foreach name="auths" item="v" key="k">
										<php>
											if($v['parentId']==$val['authId']):
										</php>

											<label class="checkbox-inline">
											<input type="checkbox" id="auth<{$v['authId']}>" name="auth[]" value="<{$val['authId']}>,<{$v['authId']}>"> <{$v['authName']}> </label>
										<php>
											endif;
										</php>
										</foreach>

										</div>
									</div>
								</div>
								<php>
									endif;
								</php>
								</foreach>
							
							</div>
						</div>
						
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" data-dismiss="modal" class="btn default">取消</button>
				<button type="submit" class="btn green">保存</button>
			</div>
		</div>
		</form>
	</div>	
</div>
</block>